home *** CD-ROM | disk | FTP | other *** search
/ PC Elektro 3 / PC-Elektro-3-cd1.bin / KBan 2.0 / KBANSRC.LZH / SRC / PROG / KBANDATA / COMPELEM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-23  |  1.2 KB  |  49 lines

  1. /*
  2.  * a header of the class COMPONENT_ELEMENT
  3.  * Copyright (C) 1996, 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
  4.  */
  5.  
  6. #ifndef _COMPELEM_H_
  7. #define _COMPELEM_H_
  8.  
  9. #include "prim.h"
  10.  
  11. class COMPONENT_ELEMENT : public PRIMITIVE {
  12.   bool m_select;
  13. public:
  14.   // constructors
  15.  
  16.   COMPONENT_ELEMENT()
  17.     : PRIMITIVE(),
  18.       m_select(false) {}
  19.   COMPONENT_ELEMENT(const COMPONENT_ELEMENT& src)
  20.     : PRIMITIVE(src),
  21.       m_select(src.m_select) {}
  22.   COMPONENT_ELEMENT(const PRIMITIVE& src)
  23.     : PRIMITIVE(src),
  24.       m_select(false) {}
  25.  
  26.   // operators
  27.  
  28.   bool operator==(const COMPONENT_ELEMENT& rval) const { return true; }
  29.   bool operator!=(const COMPONENT_ELEMENT& rval) const { return true; }
  30.   bool operator< (const COMPONENT_ELEMENT& rval) const { return true; }
  31.   bool operator> (const COMPONENT_ELEMENT& rval) const { return true; }
  32.  
  33.   bool is_selected() const { return m_select; }
  34.   void select  () { m_select = true ; }
  35.   void unselect() { m_select = false; }
  36.  
  37.   // block-related
  38.  
  39.   void shift(const XY& ac_dif, COMPONENT_ELEMENT& target) const;
  40.  
  41.   // miscellaneous
  42.  
  43.   bool is_in_block(const XY& ac1, const XY& ac2) const;
  44.  
  45.   int  load_170(FILE_NEW& fp);
  46. };
  47.  
  48. #endif /* _COMPELEM_H_ */
  49.